package com.goodshop.item.controller;

import com.goodshop.item.entity.Item;
import com.goodshop.item.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class ItemController {

    @Autowired
    private ItemService itemService;

    @RequestMapping("/item")
    public ResponseEntity<Item> saveItem(Item item) {

            Item result = itemService.saveItem(item);
            return ResponseEntity.status(HttpStatus.CREATED).body(result);

    }
}
